﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BitPortal.Models;
using BitPortal.Business;
using BitPortal.Utils;
using System.Web.Security;

namespace BitPortal.Admin.Feedback.Module
{
    public partial class FeedbackDetail : Controls.BaseAdminControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void BindData(long feedID)
        {
            Models.Feedback feed = FeedbackBLL.GetByID(feedID);
            if (feed != null)
            {
                lblName.Text = feed.SenderName;
                lblEmail.Text = feed.SenderEmail;
                lblPhone.Text = feed.SenderPhone;
                lblDate.Text = feed.DatetimeSend.ToString();
                lblAddress.Text = feed.SenderAddress;
                lblSubject.Text = feed.Subject;
                lblContent.Html = feed.Content;
                lblStatus.Text = feed.IsReplied ? "Đã trả lời" : "Chưa trả lời";
                if (feed.IsReplied)
                {
                    pnReply.Hidden = false;
                    if (feed.RepliedUser != null && feed.DatetimeReplied != null)
                    {
                        lblReplier.Text = Membership.GetUser(feed.RepliedUser) != null ? Membership.GetUser(feed.RepliedUser).UserName : feed.RepliedUser.ToString();
                        lblDateReplied.Text = feed.DatetimeReplied.ToString();
                    }
                }
                Window1.Show();
            }
        }
    }

}